package dq.study.nio.demo;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 * @author dongqun
 * @version 1.0
 * @description ${description}
 * @date 2019/8/29 19:08
 */
public class NioTest {
    public static void main(String[] args){
        NioClient client = new NioClient();
        client.start();
        BufferedReader sin = new BufferedReader(new InputStreamReader(System.in));
        try{
            String readline;
            while((readline = sin.readLine())!=null){
                if(readline.equals("bye")){
                    client.close();
                    System.exit(0);
                }
                client.send(readline);
            }
        }catch(IOException e){
            e.printStackTrace();
        }
    }
}
